home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / ucrasm27.zip / SOURCE.ZIP / PUTF.ASM < prev    next >
Assembly Source File  |  1991-10-31  |  1KB  |  72 lines

  1. StdGrp        group    stdlib,stddata
  2. stddata        segment    para public 'sldata'
  3. stddata        ends
  4. ;
  5. stdlib        segment    para public 'slcode'
  6.         assume    cs:stdgrp
  7. ;
  8.         extrn    sl_malloc:far, sl_free:far, sl_puts:far
  9.         extrn    sl_ftoam:far, sl_etoam:far
  10. ;
  11. ;
  12. ; Putf-    FPACC contains a floating point value, print it to the display.
  13. ;    AL- Minimum field width
  14. ;    AH- Number of positions *after* the decimal point.
  15. ;
  16. ; Returns
  17. ;    Carry set if memory allocation error.
  18. ;
  19.         public    sl_putf
  20. sl_putf        proc    far
  21.         push    es
  22.         push    di
  23.         push    cx
  24.         mov    cl, al
  25.         mov    ch, 0
  26.         inc    cx        ;Make room for zero terminating byte.
  27.         call    sl_Malloc    ;Go allocate the storage.
  28.         jc    putfError
  29.         call    sl_ftoam    ;Convert FPACC to a string
  30.         call    sl_puts        ;Print it.
  31.         call    sl_free        ;Free up allocated storage.
  32.         clc
  33. PutfError:    pop    cx
  34.         pop    di
  35.         pop    es
  36.         ret
  37. sl_putf        endp
  38. ;
  39. ;
  40. ; Pute-    FPACC contains a floating point value, print it to the display using
  41. ;    scientific notion format.
  42. ;
  43. ;    AL- Minimum field width (should be at least eight!)
  44. ;
  45. ; Returns
  46. ;    Carry set if memory allocation error.
  47. ;
  48.         public    sl_pute
  49. sl_pute        proc    far
  50.         push    es
  51.         push    di
  52.         push    cx
  53.         mov    cl, al
  54.         mov    ch, 0
  55.         inc    cx        ;Make room for zero terminating byte.
  56.         call    sl_Malloc    ;Go allocate the storage.
  57.         jc    PuteError
  58.         call    sl_etoam    ;Convert FPACC to a string
  59.         call    sl_puts        ;Print it.
  60.         call    sl_free        ;Free up allocated storage.
  61.         clc
  62. PuteError:    pop    cx
  63.         pop    di
  64.         pop    es
  65.         ret
  66. sl_pute        endp
  67. ;
  68. ;
  69. ;
  70. stdlib        ends
  71.         end
  72.